// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL     : http://b2b.casper.com.tr/CasperServices/WebService.asmx?WSDL
//  >Import : http://b2b.casper.com.tr/CasperServices/WebService.asmx?WSDL>0
// Encoding : utf-8
// Version  : 1.0
// (21.12.2013 17:16:54 - - $Rev: 45757 $)
// ************************************************************************ //

unit WebService;

interface

uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;

const
  IS_OPTN = $0001;
  IS_REF  = $0080;


type

  // ************************************************************************ //
  // The following types, referred to in the WSDL document are not being represented
  // in this file. They are either aliases[@] of other types represented or were referred
  // to but never[!] declared in the document. The types from the latter category
  // typically map to predefined/known XML or Embarcadero types; however, they could also 
  // indicate incorrect WSDL documents that failed to declare or import a schema type.
  // ************************************************************************ //
  // !:int             - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:boolean         - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:string          - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:schema          - "http://www.w3.org/2001/XMLSchema"[GblElm]

  UrunBilgisiResult    = class;                 { "http://tempuri.org/"[Cplx] }
  UrunRecetesiResult   = class;                 { "http://tempuri.org/"[Cplx] }
  ProductSerialInfoResult = class;              { "http://tempuri.org/"[Cplx] }



  // ************************************************************************ //
  // XML       : UrunBilgisiResult, <complexType>
  // Namespace : http://tempuri.org/
  // ************************************************************************ //
  UrunBilgisiResult = class(TRemotable)
  private
  published
  end;



  // ************************************************************************ //
  // XML       : UrunRecetesiResult, <complexType>
  // Namespace : http://tempuri.org/
  // ************************************************************************ //
  UrunRecetesiResult = class(TRemotable)
  private
  published
  end;



  // ************************************************************************ //
  // XML       : ProductSerialInfoResult, <complexType>
  // Namespace : http://tempuri.org/
  // ************************************************************************ //
  ProductSerialInfoResult = class(TRemotable)
  private
    Fschema: TXMLData;
  public
    destructor Destroy; override;
  published
    property schema: TXMLData  Index (IS_REF) read Fschema write Fschema;
  end;


  // ************************************************************************ //
  // Namespace : http://tempuri.org/
  // soapAction: http://tempuri.org/%operationName%
  // transport : http://schemas.xmlsoap.org/soap/http
  // style     : document
  // use       : literal
  // binding   : WebServiceSoap12
  // service   : WebService
  // port      : WebServiceSoap12
  // URL       : http://b2b.casper.com.tr/CasperServices/WebService.asmx
  // ************************************************************************ //
  WebServiceSoap = interface(IInvokable)
  ['{5F31D6D2-21F3-38E6-BBED-8E386D97BCE2}']
    function  HelloWorld: string; stdcall;
    function  GetSerialNumByImei(const IMEINumber: string): string; stdcall;
    function  GetSerialNumByImei2(const IMEINumber1: string; const IMEINumber2: string): string; stdcall;
    function  UrunBilgisi(const SeriNo: string): UrunBilgisiResult; stdcall;
    function  UrunRecetesi(const SeriNo: string): UrunRecetesiResult; stdcall;
    function  ProductSerialInfo(const SerialNo: string): ProductSerialInfoResult; stdcall;
    function  MerkezKayit(const SeriNo: string; const FirmaKodu: string; const Aciklama: string; const MusteriAdi: string; const Email: string; const Telefon: string; 
                          const AcikAdres: string; const il: string; const ilce: string): string; stdcall;
    function  OnarimAsamasi(const ServiceOrderID: string; const AxDurumAdi: string; const YapilanIslem: string; const TeknisyenNotu: string): Boolean; stdcall;
    function  ParcaArizaHareketleri(const ServiceOrderID: string; const UrunKodu: string; const BildirilenAriza: string; const TespitEdilenAriza: string; const UrunDurumu: Integer; const HataDurumu: Integer
                                    ): Boolean; stdcall;
  end;

function GetWebServiceSoap(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): WebServiceSoap;


implementation
  uses SysUtils;

function GetWebServiceSoap(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): WebServiceSoap;
const
  defWSDL = 'http://b2b.casper.com.tr/CasperServices/WebService.asmx?WSDL';
  defURL  = 'http://b2b.casper.com.tr/CasperServices/WebService.asmx';
  defSvc  = 'WebService';
  defPrt  = 'WebServiceSoap12';
var
  RIO: THTTPRIO;
begin
  Result := nil;
  if (Addr = '') then
  begin
    if UseWSDL then
      Addr := defWSDL
    else
      Addr := defURL;
  end;
  if HTTPRIO = nil then
    RIO := THTTPRIO.Create(nil)
  else
    RIO := HTTPRIO;
  try
    Result := (RIO as WebServiceSoap);
    if UseWSDL then
    begin
      RIO.WSDLLocation := Addr;
      RIO.Service := defSvc;
      RIO.Port := defPrt;
    end else
      RIO.URL := Addr;
  finally
    if (Result = nil) and (HTTPRIO = nil) then
      RIO.Free;
  end;
end;


destructor ProductSerialInfoResult.Destroy;
begin
  SysUtils.FreeAndNil(Fschema);
  inherited Destroy;
end;

initialization
  { WebServiceSoap }
  InvRegistry.RegisterInterface(TypeInfo(WebServiceSoap), 'http://tempuri.org/', 'utf-8');
  InvRegistry.RegisterDefaultSOAPAction(TypeInfo(WebServiceSoap), 'http://tempuri.org/%operationName%');
  InvRegistry.RegisterInvokeOptions(TypeInfo(WebServiceSoap), ioDocument);
  InvRegistry.RegisterInvokeOptions(TypeInfo(WebServiceSoap), ioSOAP12);
  { WebServiceSoap.HelloWorld }
  InvRegistry.RegisterMethodInfo(TypeInfo(WebServiceSoap), 'HelloWorld', '',
                                 '[ReturnName="HelloWorldResult"]', IS_OPTN);
  { WebServiceSoap.GetSerialNumByImei }
  InvRegistry.RegisterMethodInfo(TypeInfo(WebServiceSoap), 'GetSerialNumByImei', '',
                                 '[ReturnName="GetSerialNumByImeiResult"]', IS_OPTN);
  { WebServiceSoap.GetSerialNumByImei2 }
  InvRegistry.RegisterMethodInfo(TypeInfo(WebServiceSoap), 'GetSerialNumByImei2', '',
                                 '[ReturnName="GetSerialNumByImei2Result"]', IS_OPTN);
  { WebServiceSoap.UrunBilgisi }
  InvRegistry.RegisterMethodInfo(TypeInfo(WebServiceSoap), 'UrunBilgisi', '',
                                 '[ReturnName="UrunBilgisiResult"]', IS_OPTN);
  { WebServiceSoap.UrunRecetesi }
  InvRegistry.RegisterMethodInfo(TypeInfo(WebServiceSoap), 'UrunRecetesi', '',
                                 '[ReturnName="UrunRecetesiResult"]', IS_OPTN);
  { WebServiceSoap.ProductSerialInfo }
  InvRegistry.RegisterMethodInfo(TypeInfo(WebServiceSoap), 'ProductSerialInfo', '',
                                 '[ReturnName="ProductSerialInfoResult"]', IS_OPTN);
  { WebServiceSoap.MerkezKayit }
  InvRegistry.RegisterMethodInfo(TypeInfo(WebServiceSoap), 'MerkezKayit', '',
                                 '[ReturnName="MerkezKayitResult"]', IS_OPTN);
  { WebServiceSoap.OnarimAsamasi }
  InvRegistry.RegisterMethodInfo(TypeInfo(WebServiceSoap), 'OnarimAsamasi', '',
                                 '[ReturnName="OnarimAsamasiResult"]');
  { WebServiceSoap.ParcaArizaHareketleri }
  InvRegistry.RegisterMethodInfo(TypeInfo(WebServiceSoap), 'ParcaArizaHareketleri', '',
                                 '[ReturnName="ParcaArizaHareketleriResult"]');
  RemClassRegistry.RegisterXSClass(UrunBilgisiResult, 'http://tempuri.org/', 'UrunBilgisiResult');
  RemClassRegistry.RegisterXSClass(UrunRecetesiResult, 'http://tempuri.org/', 'UrunRecetesiResult');
  RemClassRegistry.RegisterXSClass(ProductSerialInfoResult, 'http://tempuri.org/', 'ProductSerialInfoResult');

end.